package com.desay.pangoo.itmt.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Data;

/**
 * @author uidq1163 on [2022年12月06日上午10:16:03] <br>
 *         work group Tech classification 技术课题变更审核
 * @Modified By： [修改人] on [修改日期] for [修改说明]
 */
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "tech_project_topic")
@Data
public class TechProjectTopicEntity extends BaseEntity implements Serializable {

	private static final long serialVersionUID = -6221323589606854197L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", columnDefinition = "bigint COMMENT '主键'")
	private Long id;

	@ManyToOne(fetch = FetchType.EAGER, optional = true)
	@JoinColumn(name = "tech_project_id", columnDefinition = "bigint COMMENT '关联的课题ID'")
	@JsonIgnoreProperties({ "parent", "children", "techOnlineReview" })
	private TechProjectInfoEntity techProject;

	@OneToOne(fetch = FetchType.EAGER, optional = true)
	@JoinColumn(name = "tech_project_status_id", columnDefinition = "bigint COMMENT '关联的课题状态变更ID'")
	@JsonIgnoreProperties({ "techProject", "files", "techProjectTopic" })
	private TechProjectStatusEntity techProjectStatus;

	@Column(name = "approval_number", nullable = true, columnDefinition = "varchar(255) COMMENT '立项审批号'")
	private String approvalNumber;

	@Column(name = "project_number", nullable = true, columnDefinition = "varchar(255) COMMENT '项目编号'")
	private String projectNumber;

	@Column(name = "project_name", nullable = true, columnDefinition = "varchar(255) COMMENT '项目名称'")
	private String projectName;

	@Column(name = "start_time", nullable = true, columnDefinition = "datetime COMMENT '项目开始时间'")
	private Date startTime;

	@Column(name = "end_time", nullable = true, columnDefinition = "datetime COMMENT '项目结束'")
	private Date endTime;

	@Column(name = "landing_platform", nullable = true, columnDefinition = "varchar(255) COMMENT '落地平台'")
	private String landingPlatform;

	@Column(name = "apply_bu", nullable = true, columnDefinition = "varchar(255) COMMENT '应用BU'")
	private String applyBu;

	@Column(name = "project_profit", nullable = true, columnDefinition = "float COMMENT '项目收益'")
	private Float projectProfit;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		TechProjectTopicEntity other = (TechProjectTopicEntity) obj;
		if (id == null) {
			if (other.id != null) {
				return false;
			}
		} else if (!id.equals(other.id)) {
			return false;
		}
		return true;
	}
}
